import request from '@/config/axios'

// 项目 VO
export interface ProjectVO {
  id: number // 参数主键
  companyName: string // 委托单位名称
  projectType: string // 项目类型
  projectManager: string // 项目负责人
  urgencyLevel: string // 紧急程度
  completionDate: Date // 要求完成时间
  receivingUnit: string // 受检单位
  receivingAddress: string // 受检地址
  contactPerson: string // 单位联系人
  contactPhone: string // 受检电话
  taskSource: string // 任务来源
  contractNumber: string // 合同编号
  projectNo: string // 编号方式(自动编号/手动编号)
  projectName: string // 项目名称
  businessPerson: string // 业务员
  businessPhone: string // 业务电话
  contractDate: Date // 合同日期
  remarks: string // 备注
}

// 项目 API
export const ProjectApi = {
  getMaterialClassList: async (type: any) => {
    return await request.get({ url: `/dk/project/tree?type=` + type })
  },
  // 查询项目分页
  getProjectPage: async (params: any) => {
    return await request.get({ url: `/dk/project/page`, params })
  },
  getProjectMyPage: async (params: any) => {
    return await request.get({ url: `/dk/project/myPage`, params })
  },

  // 查询项目分页
  getStatusCount: async (params: any) => {
    return await request.get({ url: `/dk/project/getStatusCount`, params })
  },
  getMyStatusCount: async (params: any) => {
    return await request.get({ url: `/dk/project/getMyStatusCount`, params })
  },

  // 查询项目详情
  getProject: async (id: number) => {
    return await request.get({ url: `/dk/project/get?id=` + id })
  },

  // 查报告签名信息

  getProjectSign: async (id: number, reportType: string | number) => {
    return await request.get({
      url: `/dk/project-sign/get?id=${id}&reportType=${reportType}`
    })
  },
  // 修改项目
  updateProjectSign: async (data: any) => {
    return await request.put({ url: `/dk/project-sign/update`, data })
  },

  getExperimentalResults: async (id: number) => {
    return await request.get({ url: `/dk/project/getExperimentalResults?id=` + id })
  },

  // 新增项目
  createProject: async (data: ProjectVO) => {
    return await request.post({ url: `/dk/project/create`, data })
  },

  // 修改项目
  updateProject: async (data: any) => {
    return await request.put({ url: `/dk/project/update`, data })
  },

  // 调查分配
  surveyAllocation: async (data: any) => {
    return await request.put({ url: `/dk/project/surveyAllocation`, data })
  },
  // 采样分配
  samplingAllocation: async (data: any) => {
    return await request.put({ url: `/dk/project/samplingAllocation`, data })
  },

  // 修改项目现场调查
  updateProjectFieldSurvey: async (data: any) => {
    return await request.put({ url: `/dk/project/updateProjectFieldSurvey`, data })
  },
  // 项目审核
  updateSurveyReview: async (data: any) => {
    return await request.put({ url: `/dk/project/updateSurveyReview`, data })
  },

  // 有机化学品原料/粉尘取样记录表
  updateUnknownAnalysisSampling: async (data: any) => {
    return await request.put({ url: `/dk/project/updateUnknownAnalysisSampling`, data })
  },

  updateUnknownAnalysisResult: async (data: any) => {
    return await request.put({ url: `/dk/project/updateUnknownAnalysisResult`, data })
  },

  // 样品交接记录表
  updateSampleHandoverRecord: async (data: any) => {
    return await request.put({ url: `/dk/project/updateSampleHandoverRecord`, data })
  },

  updateUnknownAnalysisHandoverRecord: async (data: any) => {
    return await request.put({ url: `/dk/project/updateUnknownAnalysisHandoverRecord`, data })
  },
  // 保存二氧化硅记录
  updateEyhg: async (data: any) => {
    return await request.put({ url: `/dk/project/updateEyhg`, data })
  },

  // 更新个体和定点信息
  updateHarmfulFactorsRecord: async (data: any) => {
    return await request.put({ url: `/dk/project/updateHarmfulFactorsRecord`, data })
  },
  // 更新调查的时候选中的滤膜id
  updateBeforeSampleLM: async (data: any) => {
    return await request.put({ url: `/dk/project/updateBeforeSampleLM`, data })
  },

  // 有机化学品原料/粉尘取样记录表
  getUnknownAnalysisSampling: async (id: number) => {
    return await request.get({ url: `/dk/project/getUnknownAnalysisSampling?projectId=` + id })
  },

  getDefaultUnknownAnalysisSampling: async (id: number) => {
    return await request.get({ url: `/dk/project/getDefaultUnknownAnalysisSampling?projectId=` + id })
  },

  getUnknownAnalysisResult: async (id: number) => {
    return await request.get({ url: `/dk/project/getUnknownAnalysisResult?projectId=` + id })
  },

  getDefaultUnknownAnalysisResult: async (id: number) => {
    return await request.get({ url: `/dk/project/getDefaultUnknownAnalysisResult?projectId=` + id })
  },

  synchronizationUnknownAnalysisResult: async (id: any) => {
    return await request.get({ url: `/dk/project/synchronizationUnknownAnalysisResult?id=` + id })
  },
  getEconomicCategories: async (query: string) => {
    return await request.get({ url: `/dk/api/getEconomicCategories?query=` + query })
  },
  getEnterpriseTypes: async () => {
    return await request.get({ url: `/dk/api/getEnterpriseTypes` })
  },

  getThreshold: async (industry: string, totalEmployees: string | number) => {
    return await request.get({
      url: `/dk/api/getThreshold?industry=${industry}&totalEmployees=${totalEmployees}`
    })
  },

  // 修改项目现场调查
  updateJobSurvey: async (data: any) => {
    return await request.put({ url: `/dk/project/updateJobSurvey`, data })
  },
  // 点位示意图
  updateJobSurveySketch: async (data: any) => {
    return await request.put({ url: `/dk/project/updateJobSurveySketch`, data })
  },
  // 获得示意图
  getJobSurveySketch: async (id: any) => {
    return await request.get({
      url: `/dk/project/getJobSurveySketch?projectId=${id}`
    })
  },

  // 查询项目详情
  getProjectFieldSurvey: async (id: number) => {
    return await request.get({ url: `/dk/project/getProjectFieldSurvey?projectId=` + id })
  },

  // 获取项目方案中车间和岗位名称
  getWorkShopPositionName: async (id: number,type:number) => {
    return await request.get({ url: `/dk/project/getWorkShopPositionName?projectId=${id}&type=${type}`})
  },

  // 获取项目方案中车间和岗位名称和地点
  getWorkShopPositionNameTestItem: async (id: number, name: string) => {
    return await request.get({
      url: `/dk/project/getWorkShopPositionNameTestItem?projectId=${id}&name=${name}`
    })
  },

  checkStatus: async (id: any, targetStatus: number) => {
    return await request.get({
      url: `/dk/project/checkStatus?id=${id}&targetStatus=${targetStatus}`
    })
  },

  // 获取项目方案审核消息
  getSurveyReview: async (id: number) => {
    return await request.get({ url: `/dk/project/getSurveyReview?projectId=` + id })
  },

  // 从方案获取默认个体和定点的采样信息
  getDefaultHarmfulFactorsRecord: async (projectId: number) => {
    return await request.get({
      url: `/dk/project/getDefaultHarmfulFactorsRecord?projectId=${projectId}`
    })
  },

  // 从现场采样获取信息
  getTextReport: async (projectId: number) => {
    return await request.get({
      url: `/dk/project/getTextReport?id=${projectId}`
    })
  },
  getDefaultBeforeSample: async (projectId: number) => {
    return await request.get({
      url: `/dk/project/getDefaultBeforeSample?projectId=${projectId}`
    })
  },

  getDefaultAfterSample: async (projectId: number) => {
    return await request.get({
      url: `/dk/project/getDefaultAfterSample?projectId=${projectId}`
    })
  },

  getBeforeSample: async (projectId: number) => {
    return await request.get({
      url: `/dk/project/getBeforeSample?projectId=${projectId}`
    })
  },
  getAfterSample: async (projectId: number) => {
    return await request.get({
      url: `/dk/project/getAfterSample?projectId=${projectId}`
    })
  },

  // 从数据获取方案获取默认个体和定点的采样信息
  getHarmfulFactorsRecord: async (projectId: number) => {
    return await request.get({
      url: `/dk/project/getHarmfulFactorsRecord?projectId=${projectId}`
    })
  },
  // 从调查中获取检测结果数据处理原始
  getGetProjectDataProcessing: async (projectId: number) => {
    return await request.get({
      url: `/dk/project/getGetProjectDataProcessing?id=${projectId}`
    })
  },
  // 预览项目现场调查信息
  previewProjectFieldSurvey: async (id: number) => {
    return await request.download({ url: `/dk/project/previewProjectFieldSurvey?projectId=` + id })
  },

  // 32现场采样测量计划审核表.docx
  previewJobSurvey: async (id: number) => {
    return await request.download({ url: `/dk/project/previewJobSurvey?projectId=` + id })
  },

  previewtHarmfulFactorsRecord: async (id: number) => {
    return await request.download({
      url: `/dk/project/previewHarmfulFactorsRecord?projectId=${id}`
    })
  },
  previewtSampleHandoverRecord: async (id: number, pdfType: number) => {
    return await request.download({
      url: `/dk/project/previewSampleHandoverRecord?projectId=${id}&pdfType=${pdfType}`
    })
  },
  previewtBeforeSample: async (id: number) => {
    return await request.download({ url: `/dk/project/previewBeforeSample?projectId=${id}` })
  },

  previewtAfterSample: async (id: number) => {
    return await request.download({ url: `/dk/project/previewAfterSample?projectId=${id}` })
  },

  previewtEyhg: async (id: number) => {
    return await request.download({ url: `/dk/project/previewEyhg?projectId=${id}` })
  },
  previewExperimentalResults: async (id: number) => {
    return await request.download({ url: `/dk/project/previewExperimentalResults?projectId=${id}` })
  },

  previewRgularlyTestTemplates: async (id: number) => {
    return await request.download({
      url: `/dk/project/previewRgularlyTestTemplates?projectId=${id}`
    })
  },
  resultCalculation: async (id: number) => {
    return await request.download({ url: `/dk/project/previewResultCalculation?projectId=${id}` })
  },
  // 查询项目方案
  getJobSurvey: async (id: number) => {
    return await request.get({ url: `/dk/project/getJobSurvey?projectId=` + id })
  },

  // 修改项目的耗材信息
  updateConsumable: async (data: any) => {
    return await request.put({ url: `/dk/project/updateConsumable`, data })
  },
  // 更新采样前滤膜质量
  updateBeforeSample: async (data: any) => {
    return await request.put({ url: `/dk/project/updateBeforeSample`, data })
  },
  updateAfterSample: async (data: any) => {
    return await request.put({ url: `/dk/project/updateAfterSample`, data })
  },
  updateExperimentalResults: async (data: any) => {
    return await request.put({ url: `/dk/project/updateExperimentalResults`, data })
  },

  // 根据方案获得项目耗材信息
  getDefaultConsumable: async (id: number) => {
    return await request.get({ url: `/dk/project/getDefaultConsumable?id=` + id })
  },

  getConsumableInfo: async (id: number) => {
    return await request.get({ url: `/dk/project/getConsumableInfo?id=` + id })
  },

  getSampleHandoverRecord: async (id: number) => {
    return await request.get({ url: `/dk/project/getSampleHandoverRecord?id=` + id })
  },
  getUnknownAnalysisHandoverRecord: async (id: number) => {
    return await request.get({ url: `/dk/project/getUnknownAnalysisHandoverRecord?id=` + id })
  },
  // 获得采样编号
  getSampleNo: async (id: number) => {
    return await request.get({ url: `/dk/project/getSampleNo?id=` + id })
  },

  resetSampleNo: async (id: number) => {
    return await request.get({ url: `/dk/project/resetSampleNo?id=` + id })
  },
  getDefaultSampleHandoverRecord: async (id: number) => {
    return await request.get({ url: `/dk/project/getDefaultSampleHandoverRecord?id=` + id })
  },
  getDefaultQualitativeHandoverRecord: async (id: number) => {
    return await request.get({ url: `/dk/project/getDefaultQualitativeHandoverRecord?id=` + id })
  },
  // 定性检测样品编号
  getUnknownAnalysisSampleNo: async (id: number) => {
    return await request.get({ url: `/dk/project/getUnknownAnalysisSampleNo?id=` + id })
  },

  // 预览项目现场调查信息
  previewConsumable: async (id: number) => {
    return await request.download({ url: `/dk/project/previewConsumable?projectId=` + id })
  },
  // 有机化学品原料/粉尘取样记录表
  previewUnknownAnalysisRecord: async (id: number) => {
    return await request.download({
      url: `/dk/project/previewUnknownAnalysisRecord?projectId=` + id
    })
  },
  // 现场采样测量计划审核表
  previewPlanAudit: async (id: number) => {
    return await request.download({ url: `/dk/project/previewPlanAudit?projectId=` + id })
  },
  // 采样器采样前流量校准记录表
  reviewCalibration: async (id: number) => {
    return await request.download({ url: `/infra/facility-log/reviewCalibration?id=` + id })
  },

  receiveInfoReview: async (id: number) => {
    return await request.download({ url: `/infra/facility-log/receiveInfoReview?id=` + id })
  },
  reviewRegistrationCalibrationRecord: async (id: number) => {
    return await request.download({ url: `/infra/facility-log/reviewRegistrationCalibrationRecord?id=` + id })
  },

  // 删除项目
  deleteProject: async (id: number) => {
    return await request.delete({ url: `/dk/project/delete?id=` + id })
  },

  // 导出项目 Excel
  exportProject: async (params) => {
    return await request.download({ url: `/dk/project/export-excel`, params })
  }
}
